# Generated manually to create initial food categories

from django.db import migrations

def create_initial_categories(apps, schema_editor):
    FoodCategory = apps.get_model('main', 'FoodCategory')
    
    categories = [
        {'name': '川菜', 'description': '四川菜系，以麻辣著称'},
        {'name': '粤菜', 'description': '广东菜系，清淡鲜美'},
        {'name': '鲁菜', 'description': '山东菜系，口味偏咸'},
        {'name': '苏菜', 'description': '江苏菜系，甜味适中'},
        {'name': '浙菜', 'description': '浙江菜系，清淡爽口'},
        {'name': '闽菜', 'description': '福建菜系，汤品丰富'},
        {'name': '湘菜', 'description': '湖南菜系，香辣开胃'},
        {'name': '徽菜', 'description': '安徽菜系，重油重色'},
        {'name': '面食', 'description': '各种面条、包子、饺子等'},
        {'name': '汤品', 'description': '各种汤类食物'},
        {'name': '甜点', 'description': '蛋糕、布丁、冰淇淋等'},
        {'name': '饮品', 'description': '各种饮料、茶类'},
        {'name': '快餐', 'description': '汉堡、炸鸡、披萨等'},
        {'name': '素食', 'description': '素食类食物'},
        {'name': '海鲜', 'description': '鱼类、虾类、贝类等'},
    ]
    
    for category_data in categories:
        FoodCategory.objects.get_or_create(
            name=category_data['name'],
            defaults={'description': category_data['description']}
        )

def reverse_create_categories(apps, schema_editor):
    FoodCategory = apps.get_model('main', 'FoodCategory')
    FoodCategory.objects.all().delete()

class Migration(migrations.Migration):

    dependencies = [
        ('main', '0005_add_tag_parent'),
    ]

    operations = [
        migrations.RunPython(create_initial_categories, reverse_create_categories),
    ]

